package com.dyp.liquibasedemo;
import liquibase.integration.spring.SpringLiquibase;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.DefaultResourceLoader;

import javax.sql.DataSource;

//@Configuration
public class LiquibaseConfig {
    @Bean
    public SpringLiquibase configLiquibase(DataSource dataSource) {
        SpringLiquibase springLiquibase = new SpringLiquibase();
        springLiquibase.setChangeLog("classpath*:db/changelog/db.changelog-master.xml");
        springLiquibase.setDataSource(dataSource);
        springLiquibase.setShouldRun(true);
        springLiquibase.setResourceLoader(new DefaultResourceLoader());
//        springLiquibase.setDatabaseChangeLogTable("database_change_log");
//        springLiquibase.setDatabaseChangeLogLockTable("database_change_log_lock");
        return springLiquibase;
    }
}
